\(\int \frac {\tan ^2(a+i \log (x))}{x} \, dx\) [147]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 18 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=-\log (x)-i \tan (a+i \log (x)) \]

[Out]

-ln(x)-I*tan(a+I*ln(x))

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {3554, 8} \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=-\log (x)-i \tan (a+i \log (x)) \]

[In]

Int[Tan[a + I*Log[x]]^2/x,x]

[Out]

-Log[x] - I*Tan[a + I*Log[x]]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = \text {Subst}\left (\int \tan ^2(a+i x) \, dx,x,\log (x)\right ) \\ & = -i \tan (a+i \log (x))-\text {Subst}(\int 1 \, dx,x,\log (x)) \\ & = -\log (x)-i \tan (a+i \log (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 28, normalized size of antiderivative = 1.56 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=i \arctan (\tan (a+i \log (x)))-i \tan (a+i \log (x)) \]

[In]

Integrate[Tan[a + I*Log[x]]^2/x,x]

[Out]

I*ArcTan[Tan[a + I*Log[x]]] - I*Tan[a + I*Log[x]]

Maple [A] (verified)

Time = 0.55 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.94

method result size
norman \(-\ln \left (x \right )-i \tan \left (a +i \ln \left (x \right )\right )\) \(17\)
parallelrisch \(-\ln \left (x \right )-i \tan \left (a +i \ln \left (x \right )\right )\) \(17\)
risch \(-\ln \left (x \right )+\frac {2}{1+\frac {{\mathrm e}^{2 i a}}{x^{2}}}\) \(21\)
derivativedivides \(-i \left (\tan \left (a +i \ln \left (x \right )\right )-\arctan \left (\tan \left (a +i \ln \left (x \right )\right )\right )\right )\) \(24\)
default \(-i \left (\tan \left (a +i \ln \left (x \right )\right )-\arctan \left (\tan \left (a +i \ln \left (x \right )\right )\right )\right )\) \(24\)

[In]

int(tan(a+I*ln(x))^2/x,x,method=_RETURNVERBOSE)

[Out]

-ln(x)-I*tan(a+I*ln(x))

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 30 vs. \(2 (14) = 28\).

Time = 0.24 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.67 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=-\frac {{\left (x^{2} + e^{\left (2 i \, a\right )}\right )} \log \left (x\right ) + 2 \, e^{\left (2 i \, a\right )}}{x^{2} + e^{\left (2 i \, a\right )}} \]

[In]

integrate(tan(a+I*log(x))^2/x,x, algorithm="fricas")

[Out]

-((x^2 + e^(2*I*a))*log(x) + 2*e^(2*I*a))/(x^2 + e^(2*I*a))

Sympy [A] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.22 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=- \log {\left (x \right )} - \frac {2 e^{2 i a}}{x^{2} + e^{2 i a}} \]

[In]

integrate(tan(a+I*ln(x))**2/x,x)

[Out]

-log(x) - 2*exp(2*I*a)/(x**2 + exp(2*I*a))

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.94 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=i \, a - \log \left (x\right ) - i \, \tan \left (a + i \, \log \left (x\right )\right ) \]

[In]

integrate(tan(a+I*log(x))^2/x,x, algorithm="maxima")

[Out]

I*a - log(x) - I*tan(a + I*log(x))

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.94 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=i \, a - \log \left (x\right ) - i \, \tan \left (a + i \, \log \left (x\right )\right ) \]

[In]

integrate(tan(a+I*log(x))^2/x,x, algorithm="giac")

[Out]

I*a - log(x) - I*tan(a + I*log(x))

Mupad [B] (verification not implemented)

Time = 26.82 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.89 \[ \int \frac {\tan ^2(a+i \log (x))}{x} \, dx=-\ln \left (x\right )-\mathrm {tan}\left (a+\ln \left (x\right )\,1{}\mathrm {i}\right )\,1{}\mathrm {i} \]

[In]

int(tan(a + log(x)*1i)^2/x,x)

[Out]

- tan(a + log(x)*1i)*1i - log(x)